package xxl.robotlegs.utils 
{
	import xxl.robotlegs.framework.api.IInjector;
	/**
	 * ...
	 * @author XXL
	 */
	public class HookUtil 
	{
		
		[Inject]
		public static function ApplyHooks(hooks:Array, injector:IInjector):void
		{
			const len:int = hooks.length;
			for (var i:int = 0; i < len; i++) 
			{
				var hook:Object = hooks[i];
				if (hooks is Function)
				{
					(hook as Function)();
					continue;
				}
				if (hook is Class)
				{
					hook = injector
						? injector.instantiateUnmapped(hook as Class)
						: new (hook as Class);
				}
				hook.hook();
			}
		}
		
	}

}